/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.trade;


import com.enation.app.javashop.client.trade.OrderMetaClient;
import com.enation.app.javashop.core.client.fallback.trade.OrderMetaClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.promotion.fulldiscount.dos.FullDiscountGiftDO;
import com.enation.app.javashop.model.trade.order.dos.OrderMetaDO;
import com.enation.app.javashop.model.trade.order.enums.OrderMetaKeyEnum;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 订单操作SDK
 *
 * @author fk create in 2020/4/7
 * @version v2.0
 * @since v7.2.0
 */
@FeignClient(name = "trade-service", fallbackFactory = OrderMetaClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface OrderMetaClientFeignImpl extends OrderMetaClient {


    /**
     * 添加OrderMeta
     * @param orderMetaDO
     */
    @Override
    @RequestMapping(value = "/client/orders/order-meta", method = RequestMethod.POST)
    void add(@RequestBody OrderMetaDO orderMetaDO);

    /**
     * 获取订单赠品信息集合
     * @param orderSn 订单编号
     * @param status 订单赠品的售后状态
     * @return
     */
    @Override
    @RequestMapping(value = "/client/orders/{order_sn}/order-meta/gift-list", method = RequestMethod.GET)
    List<FullDiscountGiftDO> getGiftList(@PathVariable("order_sn") String orderSn, @RequestParam("status") String status);

    /**
     * 修改订单元信息状态
     * @param orderSn
     * @param metaKey
     * @param status
     * @return
     */
    @Override
    @PutMapping("/client/orders/{order_sn}/order-meta/status")
    void updateMetaStatus(@PathVariable("order_sn") String orderSn,@RequestParam("meta_key")  OrderMetaKeyEnum metaKey,  @RequestParam("status") String status);

    /**
     * 读取订单元信息
     * @param orderSn
     * @param metaKey
     * @return
     */
    @Override
    @GetMapping("/client/orders/{order_sn}/meta-value")
    String getMetaValue(@PathVariable("order_sn")String orderSn, @RequestParam("meta_key")OrderMetaKeyEnum metaKey);

}
